<?php
	$type = escapestr($_REQUEST['type']);
	if ($type==-1) unset($type);
	if ($type=="") unset($type);	
	$query = "Select * from `photos` where `access`='0'";
	if (isset($type)) $query .= " and `type`='$type'";
	$query .=  "order by `time` desc";
	$result 		=	 mysql_query($query);
	if (!$result) die($query);
	if (mysql_num_rows($result)) {
		while ($recent = mysql_fetch_assoc($result)){

			$photos .=      "<div class=\"photothumb\"><a href=\"/index.php?do=viewphoto&photo_id=".$recent['id']."\">
											<img border=\"0\" src=\"index.php?do=getphoto&square=1&size=100&id=".$recent['id']."\" alt=\"".
											$photoinfo['title']."\"></a></div>";		
			}

	if (!isset($type)) $all = 'selected'; 
	else{ 
	
		if ($type==0) $type0='selected';	
		if ($type==1) $type1='selected';	
		if ($type==2) $type2='selected';	
		if ($type==3) $type3='selected';	
		if ($type==4) $type4='selected';	
		if ($type==5) $type5='selected';	
		if ($type==6) $type6='selected';	
		if ($type==7) $type7='selected';	
		if ($type==8) $type8='selected';	
		if ($type==9) $type9='selected';	
		if ($type==10) $typeA='selected';	
	}
	$select .= "<form><input type=hidden name=do value=photobrowse>
	<select name=\"type\" size=\"1\">
		<option value=\"-1\" $all	>".GetLangString($lang,"txt_all")."</option>
		<option value=\"0\" $type0	>".GetLangString($lang,"txt_na")."</option>
		<option value=\"1\" $type1  >".GetLangString($lang,"txt_photo_you")."</option>
		<option value=\"2\"	$type2 	>".GetLangString($lang,"txt_photo_people_you")."</option>
		<option value=\"3\" $type3	>".GetLangString($lang,"txt_photo_people_other")."</option>		
		<option value=\"4\" $type4	>".GetLangString($lang,"txt_photo_no-people")."</option>		
		<option value=\"5\" $type5	>".GetLangString($lang,"txt_art_drawing")."</option>		
		<option value=\"6\" $type6	>".GetLangString($lang,"txt_art_painting")."</option>		
		<option value=\"7\" $type7	>".GetLangString($lang,"txt_art_other")."</option>		
		<option value=\"8\" $type8	>".GetLangString($lang,"txt_art_digital_pixel")."</option>		
		<option value=\"9\" $type9	>".GetLangString($lang,"txt_art_digital_vector")."</option>		
		<option value=\"10\" $typeA	>".GetLangString($lang,"txt_art_digital_other")."</option>			
	</select>
	<input type=submit value='".GetLangString($lang,"txt_phototype")."'>
	</form>";
	
	$SITE_MIDDLE .= FormatElement( GetLangString ($lang, "txt_browsephotos") , "$select <br>$photos" ) ;	
	}
?>
